<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script>
    			$(function (){
    				$("#sub-btn").click(function(){
    					var name=$("#name").val();
    					var pwd=$("#password").val();
    					$.ajax({
    						url:"LoginServlet",
							type:"post",
							dataType:"html",
							data:{"name":name,"password":pwd},
							success:function(data){
								int num=data;
								if(num.equals("1")){
									alert(1);
									$("#message").text("你成功了");
								}	
								else{
									$("#message").text("你失败了");	
								}
							}
    					});
					})
    			});
			</script>
  </head>
  <body>
  			<form	id="loginForm" method="post">
  					<div id="message"></div>
					姓名：<input type="text" id="name" /><br/>
					密码：<input type="password" id="password" /><br/>
					<input type="submit"  id="sub-btn" />
			</form>
  </body>
</html>
